﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Documents;

namespace SmartPaginator.Extensions
{
    public static class SectionExtensions
    {

        #region HeaderTemplate Attached Property

        public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.RegisterAttached(
            "HeaderTemplate",
            typeof(DataTemplate),
            typeof(SectionExtensions),
            new FrameworkPropertyMetadata(null));

        public static DataTemplate GetHeaderTemplate(DependencyObject element)
        {
            return (DataTemplate)element.GetValue(HeaderTemplateProperty);
        }

        public static void SetHeaderTemplate(DependencyObject element, DataTemplate value)
        {
            element.SetValue(HeaderTemplateProperty, value);
        }

        #endregion

        #region FooterTemplate Attached Property

        public static readonly DependencyProperty FooterTemplateProperty = DependencyProperty.RegisterAttached(
            "FooterTemplate",
            typeof(DataTemplate),
            typeof(SectionExtensions),
            new FrameworkPropertyMetadata(null));

        public static DataTemplate GetFooterTemplate(DependencyObject element)
        {
            return (DataTemplate)element.GetValue(FooterTemplateProperty);
        }

        public static void SetFooterTemplate(DependencyObject element, DataTemplate value)
        {
            element.SetValue(FooterTemplateProperty, value);
        }

        #endregion

        #region FirstPageNumber Attached Property

        public static readonly DependencyProperty FirstPageNumberProperty = DependencyProperty.RegisterAttached(
            "FirstPageNumber",
            typeof(int),
            typeof(SectionExtensions),
            new FrameworkPropertyMetadata(1));

        public static int GetFirstPageNumber(DependencyObject element)
        {
            return (int)element.GetValue(FirstPageNumberProperty);
        }

        public static void SetFirstPageNumber(DependencyObject element, int value)
        {
            element.SetValue(FirstPageNumberProperty, value);
        }

        #endregion

        #region ResetPageNumbers Attached Property

        public static readonly DependencyProperty ResetPageNumbersProperty = DependencyProperty.RegisterAttached(
            "ResetPageNumbers",
            typeof(bool),
            typeof(SectionExtensions),
            new FrameworkPropertyMetadata(false));

        public static bool GetResetPageNumbers(DependencyObject element)
        {
            return (bool)element.GetValue(ResetPageNumbersProperty);
        }

        public static void SetResetPageNumbers(DependencyObject element, bool value)
        {
            element.SetValue(ResetPageNumbersProperty, value);
        }

        #endregion
    
    }
}
